#include<stdio.h>
#include<string.h>
int size;
struct info{
	char username[20];
	char password[20];
	}user[2000];

int search(char username[],char password[])
{
	int i,j,k,l;
	
	do{
		k=(int)(username[0])%size;
		j=(k+i)%size;
		j=j*j;
		if(strcmp(user[j].username,username)==0)
		if(strcmp(user[j].password,password)==0)	
		return j;
		i+1;
	}
	while ((strcmp(user[j].username,"")!=0)&&(i<size));
	return -1;
}

int insert1(char username12[],char password12[])
{
	int i=0,j,k,l;
	j=0;
	while (i<(size*size))
	{
		k=(int)(username12[0])%size;
		j=(k+i)%size;
		j=j*j;
		
		if (strcmp(user[j].username,"")==0)
		{
		strcpy(user[j].username,username12);
		strcpy(user[j].password,password12);
		return j;
		}
		else
		{		
		i=i+1;
		}
	}
return -1;
}



void main()
{	int i,p,m,c,d;
	char username[20],password[20];
	char name1[40],password1[40];
	FILE *f,*fp1;
	;
        fp1=fopen("pari.txt","r");
    m=getc(fp1);
    while(m!=EOF)
    {
        if(m=='\n')
        {
            size++; 
	}
            m=getc(fp1);   
     
	}

	
	
	f=fopen("pari.txt","r");
	for(i=0;fscanf(f,"%s %s",username,password)!= EOF;i++)
		insert1(username,password);
		for(m=0;m<3;m++)	{
	printf("username \n");
	scanf(" %s",name1);
	printf("password \n");
	scanf(" %s",password1);
	p=search(name1,password1);
	if(d==-1)
	printf("login number %d failed \n",(m+1));
	else{
	printf("Succesfully logged in at login %d \n",(m+1));
	break;
	}
	}
	if(d==-1)
	printf("no try is left now HAAHAHAHHAHAAH:P\n");

}


